<?php
require_once 'common.php';

$params = $_GET;

try {
    $rows = SQLiteDB::getRows($params['key']??null);

    if ($rows) {
        echo json_encode(['status' => 'success', 'data' => $rows]);
    } else {
        echo json_encode(['status' => 'fail', 'data' => $rows]);
    }
} catch (Exception $e) {
    echo json_encode(['status' => 'fail', 'message' => $e->getMessage()]);
}